<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="../../output/line-base.js"></script>
</head>
<body> 
<script type="text/javascript">
    line.define('zoo.Animal', null, {
        events:['beginEat', 'endEat'],
        properties:{
            name:{
                defaultValue:'Animal'
            },
            food:{
                defaultValue:'Nothing'
            }
        },
        methods:{
            init:function (name, food) {
                if (name) {
                    this.setProperty('name', name);
                }
                if (food) {
                    this.setProperty('food', food);
                }
            },
            eat:function () {
                this.fire('beginEat');
                console.log('I am eating... ' + this.getProperty('food'));
                this.fire('endEat');
            }
        }
    });

    line.define('zoo.Mammal', zoo.Animal, {
        events:['beginWalk', 'endWalk'],
        properties:{
            legs:{
                defaultValue:0
            }
        },
        methods:{
            walk:function () {
                this.fire('beginWalk');
                console.log('I am walking...');
                this.fire('endWalk');
            }
        }
    });

    line.define('zoo.Cat', zoo.Mammal, {
        methods:{
            init:function (name, food) {
                this.inherited(name, food);
                this.setProperty('legs', 4);
            },
            eat:function () {
                this.setProperty('food', 'fish');
                this.inherited();
            }
        }
    });

    line.define('zoo.Dog', zoo.Mammal, {
        methods:{
            init:function (name, food) {
                this.inherited(name, food);
                this.setProperty('legs', 4);
            }
        }
    });

    line.define('zoo.Whale', zoo.Mammal, {
        methods:{
            walk:function () {
                console.log('I cannot walk...');
            },
            swim:function () {
                console.log('I can swim...');
            }
        }
    });

    var dinosaur = new zoo.Mammal('Dinosaur');
    dinosaur.on('beginWalk', function () {
        console.log('earthquake...');
    });

    var kitty = new zoo.Cat('Kitty');
    var pluto = new zoo.Dog('Pluto', 'Bone');
    var cruisor = new zoo.Whale('Cruisor', 'fish');
    cruisor.on('endEat', function () {
        console.log('Do not waste food...');
    });

    console.log('===== kitty.eat() =====');
    kitty.eat();
    console.log('=======================');
    console.log('=== dinosaur.walk() ===');
    dinosaur.walk();
    console.log('=======================');
    console.log('==== cruisor.eat() ====');
    cruisor.eat();
    console.log('=======================');
</script>

</body>
</html>